#pragma once

#include "Tree.h"

using namespace std;

class SemAnalyst
{
public:
	SemAnalyst(Tree tree);
	~SemAnalyst(void);
	Tree getModTree();
private:
	void parseTree();
	void setOperType(TreeNode* curNode);
	void checkConstType();
	void checkOperType();
	void convertConstNum(TreeNode* head, string toType);
	bool isEqualTypes(Variable first, Variable scnd);
	Variable getVarFromNode(TreeNode* curNode);
	bool isContainNodeWithManyChild(TreeNode* curNode);
	void addVar(Variable var, int strNum);
	bool findVar(string name);
	Variable getVar(string name);

	Tree m_tree;
	vector<Variable> m_vars;
	ErrorContainer *container;
};
